/*
 * @Description: 操作栏组件
 * @Author: ZhangHan
 * @Date: 2025-04-23 17:39:40
 * @LastEditTime: 2025-04-26 13:40:53
 * @LastEditors: Zhanghan
 */

import React from "react";
import { Button, Tooltip } from "antd";
import { TableActionProps } from "./type";
import "./component.less";

function TableAction(props: TableActionProps) {
  return (
    <>
      <div className="table-action">
        {props.actionColumns.map((item, index) =>
          item.tooltip ? (
            <Tooltip title={item.tooltip} key={index}>
              <Button
                className="mr-1"
                type="primary"
                color="primary"
                onClick={item.onClick}
                danger={item.danger}
              >
                {item.label}
              </Button>
            </Tooltip>
          ) : (
            <Button
              className="mr-1"
              type="primary"
              key={index}
              color="primary"
              onClick={item.onClick}
              danger={item.danger}
            >
              {item.label}
            </Button>
          )
        )}
      </div>
    </>
  );
}

export default TableAction;
